<!--设备选择器 可以选择变电站、线路、变压器等各种设备 -->
<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:sdu="http://sduept.com/jsf/cc">
<h:head>
	<title>选择文件夹</title>
	<style type="text/css">
.value {
	font-weight: bold;
}

.ui-tree {
	width: 400px;
	position: relative;
	height: 300px;
	overflow-y: scroll;
}
</style>
</h:head>
<!-- 
使用方法
在页面中
<p:commandButton value="选择设备" icon="ui-icon-extlink" actionListener="#{YourController.chooseEquipment()}">
<p:ajax event="dialogReturn"  listener="#{YourController.onSelectorChosen}" update="YourDataTable" />
</p:commandButton>
在自己的业务controller中 添加如下方法
public void chooseEquipment() {
        Map<String,Object> options = new HashMap<String, Object>();
        options.put("resizable", false);
        options.put("draggable", false);
        options.put("modal", true);
        options.put("width", 600);
        options.put("height", 400);
        //可用的参数stationId，selectedType
        Map<String,List<String>> params = new HashMap<>();
        List<String> selectedTypes = new ArrayList<>();
        pl.add("SubStation");
        params.put("selectedType", selectedTypes);
        RequestContext.getCurrentInstance().openDialog("/ui/common/equipment_selector_single", options, params);
    }
	public void onSelectorChosen(SelectEvent event) {
		//返回的是选择的对象
		//例如SubStation station = (SubStation) event.getObject();
	}
 -->
<h:body>
	<h:form id="toolbarForm">
		<p:toolbar id="toolbar">
			<f:facet name="left">
				<p:commandButton id="btn" value="确定" ajax="false" style="margin-right: 50px;"
					disabled="#{commonDocumentDirSelectorController.currentSelectedNode==null}"
					actionListener="#{commonDocumentDirSelectorController.selectDir}" />
			</f:facet>
		</p:toolbar>
	</h:form>
	<h:form id="dirForm">
		<p:tree id="dirList" value="#{commonDocumentDirSelectorController.root}"
			dynamic="true" animate="true" style="margin-top:5px;border:none"
			var="node" selectionMode="single"
			selection="#{commonDocumentDirSelectorController.currentSelectedNode}"
			widgetVar="dirList">
			<p:ajax event="select" update="toolbarForm:btn" />
			<p:ajax event="expand" update="dirList"
				listener="#{commonDocumentDirSelectorController.onNodeExpand}" />
			<p:treeNode type="DocumentDir" icon="fa fa-folder-open-o">
				<h:outputText value="#{node.name}" />
			</p:treeNode>
		</p:tree>
	</h:form>
</h:body>
</html>
